package com.hey.baseapplication.presenter;

import com.hey.baseapplication.bean.User;
import com.hey.baseapplication.model.ILoginModel;
import com.hey.baseapplication.model.LoginModel;
import com.hey.baseapplication.utils.MD5;
import com.hey.baseapplication.view.ILoginView;

/**
 * Created by Hey on 16/12/15.
 */

public  class LoginPresenter extends BasePresenter<ILoginView,LoginModel> {

    public LoginPresenter (ILoginView view){
        mView=view;
        mModel=new LoginModel();
    }

    public void login(){
        addSubscription(
        mModel.login(mView.getUserName(), MD5.getMD5(mView.getPassword()), new ILoginModel.OnLoginListener() {
            @Override
            public void loginSuccess(User  user) {
                mView.loginSuccess(user);
            }

            @Override
            public void loginFailed(String err) {
                 mView.loginFailed(err);
            }
        }));
    }
    public void forgetPassword(){

    }
}

